package com.gupaoedu.vip.simplefactory;

import com.gupaoedu.vip.model.HuaweiPhone;
import com.gupaoedu.vip.model.IPhone;
import com.gupaoedu.vip.model.Phone;
import com.gupaoedu.vip.model.XiaomiPhone;

/**
 * @Description: 简单工厂模式
 * @Author: fuyl
 * @since 2019年03月10日
 * @Version: 1.0
 */
public class SimpleFactory {

    public static Phone getPhone(String name){
        if("苹果手机".equals(name)){
            return new IPhone();
        }else if("华为手机".equals(name)){
            return new HuaweiPhone();
        }else if("小米手机".equals(name)){
            return new XiaomiPhone();
        }
        return null;
    }
}
